package com.zhiyin.seal.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhiyin.seal.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ApplyDao extends BaseMapper {

    Integer insertApply(@Param("apply") ApplyEntity applyEntity);

    Integer insertApplyPhotoList(@Param("photoList") List<ApplyPhotoEntity> applyPhotoEntityList);

    Integer insertApplyPdfTask(@Param("applyId") Long applyId);

    Integer insertStampPdfTask(@Param("applyId") Long applyId);

    Integer insertApplyApproval(@Param("applyId") Long applyId,@Param("processId") Long processId);

    Integer insertApplyCC(@Param("applyId") Long applyId,@Param("processId") Long processId);

    Integer updateMyApprovalFirst(@Param("applyId") Long applyId);

    List<ContractTypeEntity> selectContractTypeList();

    List<ContractTypeEntity> selectCompanyContractList(@Param("companyId") Long companyId);

    ApplyEntity selectApplyInfo(@Param("applyId") Long applyId);

    List<ApplyEntity> selectApplyListByIds(@Param("applyIdList") List<Long> applyIdList);

    List<MyApprovalEntity> selectApprovalProgress(@Param("applyId") Long applyId);

    List<MyCCEntity> selectCCProgress(@Param("applyId") Long applyId);

    List<ApplyEntity> selectAvailableApplyList(@Param("userId") Long userId);

    Long selectMyApplyTotalCount(@Param("paramsEntity") ApplySearchParamsEntity paramsEntity);

    List<ApplyEntity> selectMyApplyList(@Param("paramsEntity") ApplySearchParamsEntity paramsEntity);

    Long selectMyApprovalTotalCount(@Param("paramsEntity") ApplySearchParamsEntity paramsEntity);

    List<ApplyEntity> selectMyApprovalList(@Param("paramsEntity") ApplySearchParamsEntity paramsEntity);

    Long selectMyCCTotalCount(@Param("paramsEntity") ApplySearchParamsEntity paramsEntity);

    List<ApplyEntity> selectMyCCList(@Param("paramsEntity") ApplySearchParamsEntity paramsEntity);

    List<ApplyEntity> selectExpireApply();

    List<PdfTaskEntity> selectPendingPdfTaskList();

    List<ApplyPhotoEntity> selectApplyImageList(@Param("applyId") Long applyId,@Param("type") Integer type);

    Integer updateApplyStampUser(@Param("applyId") Long applyId,@Param("userId") Long userId);

    Integer updateApplyRevoke(@Param("applyId") Long applyId);

    Integer updateApplyClose(@Param("applyId") Long applyId);

    Integer updateApplyApprovalStatus(@Param("paramsEntity") ApprovalParamsEntity paramsEntity);

    Integer updateMyApprovalHandleStatus(@Param("paramsEntity") ApprovalParamsEntity paramsEntity,@Param("id") Long id);

    Integer updateMyApprovalLevelHandleStatus(@Param("paramsEntity") ApprovalParamsEntity paramsEntity,@Param("idList") List<Long> idList);

    Integer updateMyWaiteApprovalStatus(@Param("idList") List<Long> idList);

    Integer updateApplyStatusAndTimeConsume(@Param("paramsEntity") ApprovalParamsEntity paramsEntity);

    Integer updateApplyApprovalComment(@Param("paramsEntity") ApprovalParamsEntity paramsEntity);

    Integer updatePdfTaskStatus(@Param("taskId") Long taskId);

    Integer updateApplyPdfUrl(@Param("applyId") Long applyId,@Param("pdfUrl") String pdfUrl);

    Integer updateStampPdfUrl(@Param("applyId") Long applyId,@Param("pdfUrl") String pdfUrl);

    Integer selectHasMyAvailableApply(@Param("userId") Long userId);

    List<Long> selectMyAvailableApply();

    Integer selectHasMyApproval(@Param("userId") Long userId);

    List<MyApprovalEntity> selectWaiteApproval();

    Integer updateWaiteApproval(@Param("idList") List<Long> idList);

    List<ApprovalSmsEntity> selectWaiteApprovalSms();

    Integer updateWaiteApprovalSms(@Param("idList") List<Long> idList);

    List<ApplyNotesEntity> selectApplyNotes();

    ApplyNotesEntity selectApplyNotesByApplyId(@Param("applyId") Long applyId);

    Integer insertApplyNotes(@Param("paramsEntity") ApprovalParamsEntity paramsEntity);

    Integer updateApplyNotes(@Param("idList") List<Long> idList);

    Integer updateApplyCloseBySealId(@Param("sealId") Long sealId);
}
